#include <iostream>
#include "strblob.h"

using namespace std;

StrBlob::StrBlob() : data(make_shared<vector<string>>())
{
}

StrBlob::StrBlob(initializer_list<string> il) : data(make_shared<vector<string>>(il))
{
}

StrBlob::~StrBlob()
{
    cout << "StrBlob destructor" << endl;
}

void StrBlob::pop_back()
{
    check(0);
    data->pop_back();
}

string& StrBlob::front()
{
    check(0);
    return data->front();
}

string& StrBlob::back()
{
    check(0);
    return data->back();
}

void StrBlob::check(size_type i) const
{
    if (i >= data->size()) {
        throw out_of_range("StrBlob out of range");
    }
}
